<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Index extends CI_Controller {

	// 
	//  index.php
	//  www.6block.com
	//  
	//  Created by Will_Lee on 2011-05-17.
	//  Copyright 2011 lishuzu. All rights reserved.
	// 
	function __construct()
	{
		parent::__construct();
		$this->load->model('index_model');
	}
	
	public function index()
	{
		$data['authurl'] = '';
		$indexdata = $this->index_model->get_index_data();
		$data['activitys'] = $indexdata['activitys'];
		$data['multi'] = $indexdata['multi'];
		$sharedaid =  $this->uri->segment(4) ? intval($this->uri->segment(4)) :'';
		if ($sharedaid) {
			$share_act = $this->Activity_model->get_activity_by_aid($sharedaid);
			$share_act['goods'] = $this->Goods_model->get_goods($sharedaid, 5);
			$share_act['discount'] = explode('.', $share_act['discount']);
			$share_act['offset']['int'] = $share_act['discount'][0];
			$share_act['offset']['decimal'] = isset($share_act['discount'][1]) ? $share_act['discount'][1] : 0;
			$share_act['starttime'] = date('Y-m-d H:i:s', $share_act['starttime']);
			$share_act['endtime'] = date('Y-m-d H:i:s', $share_act['endtime']);
			$share_act['dateline'] = date('Y-m-d H:i:s', $share_act['dateline']);
			$data['share_act'] = $share_act;
		}
		$this->load->template('index_tpl',$data);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/index.php */